<%--
  Created by IntelliJ IDEA.
  User: wuyukai
  Date: 2021/11/1
  Time: 10:09 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
    <base href="http://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">
    <script type="text/javascript" src="jquery/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="layer-v3.1.1/layer/layer.js"></script>
    <script type="text/javascript">

      $(function (){
        var array= [3,6,12];
        //讲JSON数组转换成JSON字符串
        //"[3,6,12]"
        var arrayStr = JSON.stringify(array);

        //发送ajax请求
        $("#btn2").click(function (){
          $.ajax({
           "url":"send/array/plan/three.html" ,
            "type":"post",
            "data":arrayStr,
            "success":function (response) {
             alert(response);
            },

            "error":function (response) {
             alert(response);
            }
          });
        });

        $("#btn1").click(function (){
          $.ajax({
            "url":"send/array.html",
            "type":"post",
            "data":{"array":[3,6,12]},
            "dataType":"text",
            "success":function (response) {
              alert(response);
            },
            "error":function (){

            }
          });
        });
        $("#btn3").click(function() {
          layer.msg("layer的弹窗");
        });

        $("#btn5").click(function () {
          var ajaxResult = $.ajax({
            url : "/menu/get/whole/tree.json",
            data :"",
            dataType: "json",
            type : "post",
            async : false
          })
          console.log(ajaxResult);
        });
      });
    </script>
  </head>
  <body>
  <a href="${pageContext.request.contextPath}/test/ssm.html">ssm整合环境测试</a>
  <button id="btn1">Test Request Body(方案一)</button>
  <button id="btn2">Test Request Body(方案二)</button>
  <button id="btn3">点我弹框</button>
  <button id="btn4">点我再次弹框</button>
  <button id="btn5">验证是否查询到menu</button>
  </body>
</html>
